function calc(a, b)
    a = a or 1
    b = b or 2
    return a + b, a - b
end

function foo()
   error("this is error", 0)
end

function handle_error(err)
   print("error message:", err)
   print(debug.traceback())
   return "test"
end

print(pcall(calc, 11, 22))
print(pcall(foo))
print(xpcall(calc, handle_error))
print(xpcall(foo, handle_error))
